package com.qingcheng.dao;

import com.qingcheng.pojo.system.Resource;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface ResourceMapper extends Mapper<Resource> {

    @Select("SELECT res_key FROM tb_resource WHERE id IN (" +
            "\tSELECT resource_id from tb_role_resource WHERE role_id IN(" +
            "\t\tSELECT role_id from tb_admin_role WHERE admin_id IN (" +
            "\t\t\tSELECT id from tb_admin WHERE login_name=#{loginName}" +
            "\t\t)" +
            "\t)" +
            ")")
    public List<String> findResKeyByLoginName(@Param("loginName") String loginName);

}
